package com.jsh.erp.service;

import com.alibaba.fastjson.JSONObject;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * 通用查询接口
 */
public interface ICommonQuery {
    /**
     * 根据id查询明细。
     */
    Object selectOne(Long id) throws Exception;

    /**
     * 自定义查询
     */
    List<?> select(Map<String, String> parameterMap) throws Exception;

    /**
     * 查询数量
     */
    Long counts(Map<String, String> parameterMap) throws Exception;

    /**
     * 新增数据
     */
    int insert(JSONObject obj, HttpServletRequest request) throws Exception;

    /**
     * 更新数据
     */
    int update(JSONObject obj, HttpServletRequest request) throws Exception;

    /**
     * 删除数据
     */
    int delete(Long id, HttpServletRequest request) throws Exception;

    /**
     * 批量删除数据
     */
    int deleteBatch(String ids, HttpServletRequest request) throws Exception;

    /**
     * 查询名称是否存在
     */
    int checkIsNameExist(Long id, String name) throws Exception;
}